<?php
namespace app\servershoppingcart\validate;
use \app\manage\validate\BaseValidate;

class Shoppingcart extends BaseValidate
{
    
	protected $rule =   [

        //检验商品信息
        'id'  => ['integer','gt'=>0],
        'title'    => ['length'=>'2,25'],
        'price'=> ['integer','gt'=>0],
        'profile_pic' => ['min'=>2], 
        'status' => ['in'=>'-1,0,1,2,3,4'], 

        'user_id'  => ['integer','gt'=>0],
        'number'=> ['integer','gt'=>0],
        'page'=>['integer','gt'=>0],
        'listRows'=>['integer','gt'=>0,'elt'=>50],
        'limit' => ['integer','gt'=>0], 
        'orther_price' => ['array'],
        'goods_ids' => ['regex' => '^\d+(,\d+)*$'],
        'ids' => ['regex' => '^\d+(,\d+)*$'],
        'goods_infos' => ['array', 'min'=>1],
        'shoppingcart' => ['array', 'min'=>1],
    ];

    protected $message  =   [
        
    ];

    //上面必须包含以下字段，否则无效
    protected $scene = [
        'checkGoodsInfo' => [
            'id' => ['require','integer','gt'=>0],
            'title' => ['require','length'=>'2,25'],
            'profile_pic' => ['require','min'=>2],
            'price' => ['require','integer','gt'=>0],
            'status' => ['require','in'=>'1'],
            'orther_price' => ['require'],
        ],
    ];

}